﻿@model ShikijuHome.ViewModels.BlogViewModel

@{
    ViewBag.Title = "Shikiju's Blog";
}
<script src="@Url.Content("~/Scripts/blog.js")" type="text/javascript"></script>

<h2>Shikiju's Blog</h2>

@Html.ActionLink("Create New Post", "Create")


<h2>Post Number: @Model.Post.Item1</h2>
<article id="postDiv">@Model.Post.Item2 
<div>
    <div>
        <a class="button" id="@(Model.Post.Item1)">Reply</a>
    </div>
    <div id="reply@(Model.Post.Item1)" class="replyTextField" >
        <form action="../../Blog/reply" method="post">
            <input type="hidden" name="id" value="@(Model.Post.Item1)" />
            <textarea name="replyTextArea"></textarea>
            <input type="submit" value="Confirm" />
        </form>
    </div>
    </div>
    @foreach (var reply in Model.Post.Item3)
    { 
        <div id="replyDiv@(reply.Key)">@reply.Value.Message 
            @if (((ShikijuHome.ShikijuSessionObject)HttpContext.Current.Session["ShikijuSessionObject"]).id == reply.Value.OwnerId)
            {
                <a data-id="@reply.Key" class="replyDeleteButton">Delete</a> 
            }
        </div>
            
    }
</article>
